﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Workflow.Common.Dao;
using Workflow.IDAO;
using Workflow.Model;
using NHibernate.Linq;

namespace Workflow.DAO
{
	public class RoleDao : RepositoryBase<Role>, IRoleDao
	{
		/// <summary>
		/// 取得组对应的权限
		/// </summary>
		/// <param name="groupCode"></param>
		/// <returns></returns>
		public IList<Role> GetRolesForGroup(int groupCode)
		{
			var result = Session.Query<Role>();

			result = result.Where(x => x.Group.GroupCode == groupCode);

			return result.ToList();
		}
	}
}
